package com.briup.searchengine.view.web.controller;

import com.briup.searchengine.handle.*;
import org.apache.hadoop.util.ToolRunner;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author adam
 * @date 2022/12/16
 */
@RestController
public class StepController {
    @GetMapping("step1")
    public  void  step1(){
        try {
            System.exit(ToolRunner.run(new Step1_CleanData(),null));
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
    @GetMapping("step2")
    public  void  step2(){
        try {
            System.exit(ToolRunner.run(new Step2_PageRank(),null));
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
    @GetMapping("step3")
    public  void  step3(){
        try {
            System.exit(ToolRunner.run(new Step3_FindKeyWord(),null));
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
    //@GetMapping("step4")
    //public  void  step4(){
    //    try {
    //        System.exit(ToolRunner.run(new Step4_AddIdentity(),null));
    //    } catch (Exception e) {
    //        e.printStackTrace();
    //    }
    //
    //}
    @GetMapping("step5")
    public  void  step5(){
        try {
            System.exit(ToolRunner.run(new Step5_JoinCleanAndRank(),null));
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
    @GetMapping("step6")
    public  void  step6(){
        try {
            System.exit(ToolRunner.run(new Step6_HoldJoinResult(),null));
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
    @GetMapping("step7")
    public  void  step7(){
        try {
            System.exit(ToolRunner.run(new Step7_InvertIndex(),null));
        } catch (Exception e) {
            e.printStackTrace();
        }

    }


}
